using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;
using JCTimes.DomainModel.Views;

namespace JCTimes.EFRepository.Mapping
{
    public class V_PDAFunctionsMap : EntityTypeConfiguration<V_PDAFunctions>
    {
        public V_PDAFunctionsMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.ID)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.FunctionNo)
                .HasMaxLength(50);

            this.Property(t => t.FunctionName)
                .HasMaxLength(50);

            this.Property(t => t.ParentID)
                .HasMaxLength(50);

            this.Property(t => t.ParentFunctionNo)
                .HasMaxLength(50);

            this.Property(t => t.ParentFunctionName)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("V_PDAFunctions");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.FunctionNo).HasColumnName("FunctionNo");
            this.Property(t => t.FunctionName).HasColumnName("FunctionName");
            this.Property(t => t.OrderID).HasColumnName("OrderID");
            this.Property(t => t.ParentID).HasColumnName("ParentID");
            this.Property(t => t.CreateDate).HasColumnName("CreateDate");
            this.Property(t => t.ParentFunctionNo).HasColumnName("ParentFunctionNo");
            this.Property(t => t.ParentFunctionName).HasColumnName("ParentFunctionName");
        }
    }
}
